Jonas Dreßler [Sun, 13 Jul 2025 10:01:10 +0000 (12:01 +0200)]
switcherPopup: Move to a ClutterGesture for closing the popup
When the user presses a mouse button outside of the switcherPopup, the
popup should close. This broke when we moved StButton to ClutterGesture,
because the button_press_event() handler in switcherPopup will close the
popup before the click gesture recognizes.
Since we're trying to move away from direct event handling anyway, port
this functionality to a LongPressGesture with a duration of 0, so that
the popup closes immediately on button press as it used to.
Jonas Dreßler [Sat, 6 Aug 2022 12:46:50 +0000 (14:46 +0200)]
st/scroll-bar: Port scroll bar scrolling to use ClutterGesture
Avoid the troublesome event handling here and replace it with two
ClutterPanGestures, one for the trough and one for the handle.
This is a fairly non-intrusive port, there's room for a lot of
improvements, for example making the trough react to motion events too
should be fairly easy now.
Jonas Dreßler [Sat, 9 Aug 2025 17:40:54 +0000 (19:40 +0200)]
st/scroll-bar: Use an StWidget for the handle rather than a button
When we'll port the StScrollBar to use the new ClutterPanGesture, the
StButtons internal click gesture would interfere with the :active state of
the handle, because we set it in two places now: Here in StScrollBar, and in
StButton. Due to the order of gesture state changes when the scroll bar
handle pan gesture recognizes and cancels the button click gesture, the
active state will end up not being set during the actual pan.
To fix this, avoid using an StButton for the pan, and instead use a simple
StWidget.
While at it, change the CSS selector to be based on class name, not on ID.
IDs in CSS should be unique, and scroll bar handles are used more than once
in our UI.
Also, because apparently there's a Croco or St CSS parsing bug, select the
.vhandle/.hhandle class using the ">" child selector, as selecting just by
class doesn't do the trick :/
Jonas Dreßler [Sun, 10 Apr 2022 22:32:06 +0000 (00:32 +0200)]
Leave cancelling conflicting gestures to Clutters machinery
Since everything is a gesture now in the appDisplay, ClutterGesture will
do all the cancelling of other gesture by itself now, we merely have to
describe the relationship between them.
Jonas Dreßler [Wed, 3 Aug 2022 13:01:52 +0000 (15:01 +0200)]
dnd: Use ClutterGesture to start DnD interactions
With the last commit we introduced ShellDndStartGesture, so now port the
Draggable to actually use that gesture, and to move over to a ClutterGrab
once the DndStartGesture has recognized.
This is shuffling a lot of things around and removing quite a bit of code.
One thing to note is that to allow users of the DndStart gesture to specify
its relationship with other gestures (eg. to allow it run together with a
LongPressGesture), the DndStartGesture is exposed on the draggable as
the startGesture property.
Also, restore the integration with WindowPreview gestures, so all of them
are able to cooperate. This used to be done via addClickAction() in the past,
we can now specify this interaction to ClutterGesture.
Jonas Dreßler [Tue, 7 May 2024 17:07:06 +0000 (19:07 +0200)]
Add a ClutterGesture subclass for starting DND operations
Factor out the starting part of the DND operation from dnd.js and move it
into a new ClutterGesture subclass: ShellDndStartGesture
As with the previous port to ClutterGesture, this new gesture is written
in C due to performance concerns when we'll get rid of motion event
compression and start handling eg. 1000 HZ mouse events at the full rate.
This gesture now integrates with the ClutterGesture state tracking system
(giving us the benefit of coordinating with other gestures), and will
recognize (and also complete) as soon as a drag on a draggable actor should
start. As soon as that happens, the existing code in dnd.js takes over,
aquiring a (more exclusive) seat grab and handling things from there. This
porting of dnd.js will be done in the next commit.
Jonas Dreßler [Tue, 8 Jul 2025 14:58:25 +0000 (16:58 +0200)]
windowPreview: Replace the click action with a click and long press gesture
In the porting, temporarily stop integrating the WindowPreview gestures with
DnD, this used to be done through addClickAction() but DnD will change to
using gestures in later commits, making its porting moot. This integration
will be restored later on.
Jonas Dreßler [Fri, 25 Jul 2025 10:31:36 +0000 (12:31 +0200)]
edge-drag-gesture: Small improvements to gesture detection
Just a few small improvements to the accuracy of detection that came up
while porting to ClutterGesture.
- Use a fixed CANCEL_THRESHOLD instead of comparing the moved distance to
the perpendicular direction distance. Comparing to the perpendicular
distance means the point is basically allowed to travel in a max 45 degree
angle from the screen edge. Our EDGE_THRESHOLD is quite small though (20),
so after the gesture begins to recognize, it's surprisingly easy to
unwillingly cancel the gesture (just needs to move 20 pixels in the
perpendicular direction). Instead simply go with a fixed threshold for
cancelling the gesture. This has the additional upside that we'll also
move the state to CANCELLED if the gesture didn't move to RECOGNIZING
beforehand, a behavior that ClutterGesture strongly encourages.
- Introduce a cancel timeout of 200 ms, so that the gesture is cancelled
if it point is still hovering at the monitor edge for a while. The timeout
should be fairly short, as this gesture can happen on top of an application
window, and the application can't use the event until the gesture has moved
to CANCELLED, so we don't want to keep the event to ourselves for too
long.
Jonas Dreßler [Fri, 18 Mar 2022 15:25:38 +0000 (16:25 +0100)]
Port the EdgeDragAction to ClutterGesture
And since ClutterGestures will only be possible to implement in C (due to
performance concerns when we'll get rid of motion event compression and
start handling eg. 1000 HZ mouse events at the full rate), that means we
have to port the gesture to C!
It behaves mostly the same still: It's a single finger touch-only gesture
that recognizes as soon as a point that began on the monitor edge moves away
from that edge. It then emits "progress" signals with the distance from the
edge all the way until the fixed threshold distance (DRAG_DISTANCE) is
reached, where it then moves to COMPLETED.
There's definitely room for further improvements here, eg. the gesture
should probably only complete once the point is lifted from the screen.
Jonas Dreßler [Tue, 30 Apr 2024 15:50:20 +0000 (17:50 +0200)]
appDisplay: Remove action mode limitation for swipe tracker
Now that we no longer have the swipe tracker on the stage, but rather on
the actual actor that the gesture is happening on, we don't have to limit it
to specific ActionModes anymore, so remove that.
Jonas Dreßler [Thu, 31 Jul 2025 09:49:20 +0000 (11:49 +0200)]
Set debug names for swipe tracker pan gestures
Add a debug name param to swipe trackers to make gestures debugging
that sets the ClutterAction 'name' param of the pan gesture. This
should make debugging gestures easier when SwipeTrackers are involved.
Jonas Dreßler [Thu, 31 Jul 2025 09:43:57 +0000 (11:43 +0200)]
Set event phase to CAPTURE for swipe gestures starting in the session
When a swipe gesture can get triggered in the session (ie. on top of a
window, not just from the overview or other shell chrome), we want it to
receive events as soon as possible, as otherwise the clients will see
those events.
So use the CAPTURE phase for the overview gesture and the workspace
switching gesture, which makes sure the gesture sees each event before a
window gets to see it.
Jonas Dreßler [Thu, 31 Jul 2025 09:42:26 +0000 (11:42 +0200)]
swipeTracker: Port to use ClutterPanGesture
The new ClutterGesture subclass ClutterPanGesture fits the SwipeTracker
quite well. API wise the biggest difference to the TouchSwipeGesture it
was using before is that ClutterPanGesture has its own internal event
history to keep track of deltas and to calculate a velocity in the end.
That means we need to give it slighty special treatment right now, but
we'll improve that with the next commits.
So replace the internal TouchSwipeGesture and make the SwipeTracker use
ClutterPanGesture directly.
Jonas Dreßler [Sat, 31 Aug 2024 14:22:51 +0000 (16:22 +0200)]
st/button: Use ClutterClickGesture instead of own button-press tracking
Clutter has a gesture that can take care of this now, so get rid of all the
manual tracking of events let ClutterClickGesture handle it.
st_button_fake_release() is adapted to call clutter_gesture_cancel() until
everything is ported to ClutterGesture and Clutter will take care of this
automatically.
Jonas Dreßler [Fri, 18 Mar 2022 13:24:26 +0000 (14:24 +0100)]
unlockDialog: Move from TapAction to ClickGesture
ClutterClickGesture is a new subclass of ClutterGesture and implements
the same functionality as the TapAction and ClutterClickAction did,
which is why those will get removed. So move to ClutterClickGesture here
for the tap gesture.
tray/na-xembed: Destroy socket window when ending the embedding
Currently when embedding a tray icon is ended we are leaving the X11
socket window around as we don't really destroy it, while we're just
listening for its child destruction.
So, when embedding is ending we need to make sure that:
- If the plug window is still alive, move it back to its old parent
(normally that's the root window, but we query for it, to be sure)
- If the plug window has been already destroyed or reparented (by us or
by something else), we've to just destroy the socket window
tray/na-xembed: Use XShape to remove input on socket window
We don't want this window to take any input as, a part from blocking the
events on the shell representation itself, they may potentially make the
plugged window to do anything with the event is processing (such as
showing tooltips). And we don't want this since we only want to send to
those windows only the synthetic events that we explicitly control.
This was already the case before of commit ab60902058 but a similar
approach was not replicated, leading to input events being fully
processed from tray icons plugs.
It requires adding an explicit build dependency on Xext, but this is
something that mutter already depends on so not really a new dependency
unlockDialog: Do not reset the auth prompt on every tap
Currently we have a tap event tracker that causes that every time a tap
happens in the lock screen, we reset the auth prompt and this can be
particularly annoying at least in three cases:
1. Just clicking everywhere in the screen may lead the unlock entry
content to be cleared
2. Clicking in the screen while an authentication is in progress,
cancels it
3. This may break a multi-factor authentication method, as a single
click may lead previous steps to be cancelled
So, while resetting the auth prompt is important when we're about to
show it, it's not something we want to do while an authentication has
started.
As per this also do not touch the auth prompt sensitivity unless we're
in an idle phase, or we may end up overriding the auth prompt state,
leading for example to a text entry being editable while we're verifying
the secret
Takao Fujiwara [Wed, 27 Aug 2025 09:00:30 +0000 (18:00 +0900)]
ibusCandidatePopup: Fix scaling set-cursor-location-relative signal handling
Need to convert the raw coordinates to the scaled ones in gnome-shell.
IBus GtkIMModule can calculate the relative coordinates and gnome-shell
needs to provide the actual scale.
build: Include GioUnix-2.0 when scanning the libshell headers
libshell exposes in the headers types that are part of GioUnix
(DesktopAppInfo), so we should make it an explicit dependency of the
introspection parser, or we may not be able to parse these types.
Related to: https://gitlab.gnome.org/GNOME/glib/-/issues/3744
Kyrill Zorin [Mon, 11 Aug 2025 22:42:36 +0000 (23:42 +0100)]
extensionSystem: Fix extension enabling/disabling order
Move disabling of unneeded extensions before enabling new ones
in _onEnabledExtensionsChanged(). Previously, conflicting
extensions could simultaneously be active briefly, leading to
unclean states, memory leaks, freezes, or crashes.
The old logic also caused unnecessary disable/enable cycles
for newly requested extensions, wasting resources. Running
the disable step first prevents these issues.
In d6779f34dac6c80e178a308314fe59884a65f383, the switch
to shell_app_activate_action() was made without
also wrapping the action parameter in an av variant.
This patch adjusts network.js to use the correct av
variant type when attempting to connect to an
enterprise AP from the quicksettings panel.
shell: Use proper path to include girepository headers
girepository-2.0 headers are inside ${PREFIX}/include/glib-2.0/girepository
and the pkg-config file provides the glib-2.0 subpath as include
directory, so we are required to use the full header path, or we may not
be able to find them.
This is triggered a build failure in debian (with clean setup where no
libgirepository-1.0 was installed):
../src/shell-global.c:19:10: fatal error: girepository.h: No such file or
directory
19 | #include <girepository.h>
Carlos Garnacho [Sat, 9 Aug 2025 07:43:11 +0000 (09:43 +0200)]
slider: Always use physical direction on smooth scroll
Let the slider use the physical scroll direction, unaffected
by "natural scroll" settings. These widgets are not a "view"
where this setting does make sense, but rather the expectation
is that it's directly manipulable.
Florian Müllner [Sun, 10 Aug 2025 13:44:13 +0000 (15:44 +0200)]
environment: Mock more DesktopAppInfo methods
Commit ac113accf1e0927 didn't mock all DesktopAppInfo methods used by
gnome-shell, and https://gitlab.gnome.org/GNOME/glib/-/issues/3744
still hasn't been fixed.
Add the methods that are needed for the AppMenu, which hopefully are
all the remaining DesktopAppInfo methods we are using.
Florian Müllner [Sun, 26 Feb 2017 13:55:48 +0000 (14:55 +0100)]
unlockDialog: Show media notifications on lock screen
While we have included a built-in media section in the calendar for
a while, it is currently only available when the session is unlocked.
The ability to quickly pause or resume media playback directly from
the lock screen is quite handy though, so start showing them alongside
the existing screen shield notifications.
Florian Müllner [Thu, 15 Feb 2018 13:14:07 +0000 (14:14 +0100)]
mediaMessage: Don't try to raise player while locked
We don't allow windows on the lock screen, so don't raise a
player window while locked, as the result of the action would
only become visible on unlock.
Sebastian Wick [Tue, 5 Aug 2025 08:32:39 +0000 (10:32 +0200)]
brightnessManager: Make the steps of a BrightnessScale variable
This allows each brightness scale to use different number of steps when
using stepUp/stepDown. We will use this in the following commits to
better deal with backlights which have a limited amount of discrete
steps.
network: Clear connectivity queue after portal login
When full connectivity (or rather, non-portal connectivity) is achieved,
we can clear all active portal helpers.
Normally, the portal helper will signal that it is done, but it is
implemented in a racy manner. So here let's do a comprehensive big
hammer solution to guarantee the portal helper definitely gets
eventually closed even if we miss the race window in the portal helper.
(The race is: the portal helper checks connectivity status either
immediately or within a certain amount of time after a navigation policy
decision. This could theoretically be too soon, and if missed, it won't
be rescheduled.)
portalHelper: Add extra check for policy decision type
This check will always be true currently, because there are only three
possible types of policy decisions, and both of the others are already
handled above. But if new policy decision types are ever added in the
future, then we probably don't want to execute this code.
portalHelper: Reduce the connectivity check rate limit
30 seconds is much too long for GNOME Shell to notice that full
connectivity has been achieved. The portal helper is expected to be
closed once connectivity is achieved.
Note this does NOT mean we unconditionally spam the connectivity check
server every 5 seconds. A connectivity check is still only scheduled
when an actual navigation occurs.
portalHelper: Schedule recheck if it's too soon to recheck
Currently we have a 30 second limit on rechecks. A recheck that would
violate the limit is simply dropped. This causes the portal helper to
never close itself.
Instead, schedule a future recheck for as soon as the timeout expires.
This will put an upper bound on how long the portal helper will
unnecessarily remain open.
(I've also changed the logic to unconditionally emit CANCELLED in
vfunc_close_request(), since this seems more correct. This won't
actually affect anything, because gnome-shell just ignores the
CANCELLED status, but in theory it's nice to end things with an
indication that we are finished. Otherwise, CANCELLED will never be
emitted.)
Sebastian Wick [Sat, 21 Jun 2025 22:12:09 +0000 (00:12 +0200)]
shellDBus: Add the Shell.Brightness interface
This lets gnome-settings-daemon control dimming for power saving, and
set a auto brightness target for brightness sensors. This finally let's
us drop direct backlight control from g-s-d.
Sebastian Wick [Sat, 21 Jun 2025 22:10:04 +0000 (00:10 +0200)]
brightnessManager: Add keyboard shortcuts for monitor brightness control
This used to be done by g-s-d but to avoid the split brain situation,
g-s-d has to stop poking at the backlight directly. This also means that
there is no reason to round-trip through g-s-d anymore, and we can just
implement the shortcuts in gnome shell.
This also adds new shortcuts for controling the backlight of the "active
monitor" (i.e. the one with the cursor) by pressing shift as well.
Sebastian Wick [Sat, 21 Jun 2025 22:07:50 +0000 (00:07 +0200)]
status/brightness: Handle multiple monitors
The BrightnessManager exposes a global scale and per monitor scales
which we can also hook up to give users control over individual monitor
brightnesses. If there are more than one controllable backlight, the
brightness slider in quick settings becomes expandable and shows a
slider for each monitor with controllable backlight.
Sebastian Wick [Sat, 21 Jun 2025 22:06:27 +0000 (00:06 +0200)]
brightnessManager: Handle dimming and auto brightness
We don't want gnome-settings-daemon to poke directly at mutters
backlight anymore because that would be a split brain situation where
g-s and g-s-d will fight with each other. This implements a way to tell
the BrightnessManager to dim the screen and set an auto brightness
target, and the manager will set the backlight accordingly.
Sebastian Wick [Sat, 21 Jun 2025 22:17:11 +0000 (00:17 +0200)]
status/brightness: Switch to the new BrightnessManager
Instead of looking at the monitor backlights directly, connect to the
BrightnessManager global scales. Everything should continue working as
before, this simply gives the BrightnessManager control over the actual
backlight with the quick settings brightness sliders being one input.
This implements a backlight manager which creates a global and multiple
per monitor BrightnessScales and updates the backlight based on the
BrightnessScales changing and the backlight changing. It shows the OSD
in response to changes.
In the future it will also handle dimming, auto brightness and keyboard
shortcuts.
The idea is that the per monitor scale changes the ratio between monitor
brighnesses and the global scale scales the monitor brightnesses
accordingly.
Sebastian Wick [Wed, 2 Jul 2025 10:23:51 +0000 (12:23 +0200)]
osdWindow: Take per-monitor information in show and add showAll, showOne
The current API only supports showing an OSD on all monitors or on one
monitor. This change makes it possible to show the OSD on any
combination of monitors while providing simpler functions for the common
usages.
It still retains the single-event character and cancels previous OSDs on
unaffected monitors.
We will require this for the screen brightness keyboard shortcuts in the
future.